<!DOCTYPE html>
<html>
<head>
    

    

    



    <meta charset="utf-8">
    
    
    
    
    <title>IDEA中使用Protobuf的正确姿势 | Junxin&#39;s Blog</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    
    <meta name="theme-color" content="#3F51B5">
    
    
    <meta name="keywords" content="IDEA,protobuf">
    <meta name="description" content="protobuf 简介protocolbuffer(以下简称PB)是google 的一种数据交换的格式，它独立于语言，独立于平台。google 提供了多种语言的实现：java、c#、c++、go 和 python，每一种实现都包含了相应语言的编译器以及库文件。由于它是一种二进制的格式，比使用 xml 进行数据交换快许多。可以把它用于分布式应用之间的数据通信或者异构环境下的数据交换。作为一种效率和兼">
<meta name="keywords" content="IDEA,protobuf">
<meta property="og:type" content="article">
<meta property="og:title" content="IDEA中使用Protobuf的正确姿势">
<meta property="og:url" content="http://aixiaodenanhai.gitee.io/blog/2018/03/12/IDEA使用protobuf的正确姿势.html">
<meta property="og:site_name" content="Junxin&#39;s Blog">
<meta property="og:description" content="protobuf 简介protocolbuffer(以下简称PB)是google 的一种数据交换的格式，它独立于语言，独立于平台。google 提供了多种语言的实现：java、c#、c++、go 和 python，每一种实现都包含了相应语言的编译器以及库文件。由于它是一种二进制的格式，比使用 xml 进行数据交换快许多。可以把它用于分布式应用之间的数据通信或者异构环境下的数据交换。作为一种效率和兼">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="http://aixiaodenanhai.gitee.io/blog/img/posts/ideaProtobuf/1.png">
<meta property="og:image" content="http://aixiaodenanhai.gitee.io/blog/img/posts/ideaProtobuf/2.png">
<meta property="og:image" content="http://aixiaodenanhai.gitee.io/blog/img/posts/ideaProtobuf/3.png">
<meta property="og:updated_time" content="2018-04-28T15:42:48.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="IDEA中使用Protobuf的正确姿势">
<meta name="twitter:description" content="protobuf 简介protocolbuffer(以下简称PB)是google 的一种数据交换的格式，它独立于语言，独立于平台。google 提供了多种语言的实现：java、c#、c++、go 和 python，每一种实现都包含了相应语言的编译器以及库文件。由于它是一种二进制的格式，比使用 xml 进行数据交换快许多。可以把它用于分布式应用之间的数据通信或者异构环境下的数据交换。作为一种效率和兼">
<meta name="twitter:image" content="http://aixiaodenanhai.gitee.io/blog/img/posts/ideaProtobuf/1.png">
    
        <link rel="alternate" type="application/atom+xml" title="Junxin&#39;s Blog" href="/blog/atom.xml">
    
    <link rel="shortcut icon" href="/blog/favicon.ico">
    <link rel="stylesheet" href="//unpkg.com/hexo-theme-material-indigo@latest/css/style.css">
    <script>window.lazyScripts=[]</script>

    <!-- custom head -->
    

</head>

<body>
    <div id="loading" class="active"></div>

    <aside id="menu" class="hide" >
  <div class="inner flex-row-vertical">
    <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menu-off">
        <i class="icon icon-lg icon-close"></i>
    </a>
    <div class="brand-wrap" style="background-image:url(/blog/img/brand.jpg)">
      <div class="brand">
        <a href="/blog/" class="avatar waves-effect waves-circle waves-light">
          <img src="/blog/img/avatar.jpg">
        </a>
        <hgroup class="introduce">
          <h5 class="nickname">何俊鑫</h5>
          <a href="mailto:doubihah@foxmail.com" title="doubihah@foxmail.com" class="mail">doubihah@foxmail.com</a>
        </hgroup>
      </div>
    </div>
    <div class="scroll-wrap flex-col">
      <ul class="nav">
        
            <li class="waves-block waves-effect">
              <a href="/blog/"  >
                <i class="icon icon-lg icon-home"></i>
                主页
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/blog/archives"  >
                <i class="icon icon-lg icon-archives"></i>
                Archives
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/blog/tags"  >
                <i class="icon icon-lg icon-tags"></i>
                Tags
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://github.com/hejx1" target="_blank" >
                <i class="icon icon-lg icon-github"></i>
                Github
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://gitee.com/aixiaodenanhai" target="_blank" >
                <i class="icon icon-lg icon-link"></i>
                码云
              </a>
            </li>
        
      </ul>
    </div>
  </div>
</aside>

    <main id="main">
        <header class="top-header" id="header">
    <div class="flex-row">
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light on" id="menu-toggle">
          <i class="icon icon-lg icon-navicon"></i>
        </a>
        <div class="flex-col header-title ellipsis">IDEA中使用Protobuf的正确姿势</div>
        
        <div class="search-wrap" id="search-wrap">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
                <i class="icon icon-lg icon-chevron-left"></i>
            </a>
            <input type="text" id="key" class="search-input" autocomplete="off" placeholder="输入感兴趣的关键字">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="search">
                <i class="icon icon-lg icon-search"></i>
            </a>
        </div>
        
        
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menuShare">
            <i class="icon icon-lg icon-share-alt"></i>
        </a>
        
    </div>
</header>
<header class="content-header post-header">

    <div class="container fade-scale">
        <h1 class="title">IDEA中使用Protobuf的正确姿势</h1>
        <h5 class="subtitle">
            
                <time datetime="2018-03-11T16:00:00.000Z" itemprop="datePublished" class="page-time">
  2018-03-12
</time>


            
        </h5>
    </div>

    


</header>


<div class="container body-wrap">
    
    <aside class="post-widget">
        <nav class="post-toc-wrap post-toc-shrink" id="post-toc">
            <h4>TOC</h4>
            <ol class="post-toc"><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#protobuf-简介"><span class="post-toc-number">1.</span> <span class="post-toc-text">protobuf 简介</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#安装-Protobuf-Support-插件"><span class="post-toc-number">2.</span> <span class="post-toc-text">安装 Protobuf Support 插件</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#将-proto-文件转成-Java-类"><span class="post-toc-number">3.</span> <span class="post-toc-text">将 .proto 文件转成 Java 类</span></a></li></ol>
        </nav>
    </aside>


<article id="post-IDEA使用protobuf的正确姿势"
  class="post-article article-type-post fade" itemprop="blogPost">

    <div class="post-card">
        <h1 class="post-card-title">IDEA中使用Protobuf的正确姿势</h1>
        <div class="post-meta">
            <time class="post-time" title="2018-03-12 00:00:00" datetime="2018-03-11T16:00:00.000Z"  itemprop="datePublished">2018-03-12</time>

            


            
<span id="busuanzi_container_page_pv" title="文章总阅读量" style='display:none'>
    <i class="icon icon-eye icon-pr"></i><span id="busuanzi_value_page_pv"></span>
</span>


        </div>
        <div class="post-content" id="post-content" itemprop="postContent">
            <h1 id="protobuf-简介"><a href="#protobuf-简介" class="headerlink" title="protobuf 简介"></a>protobuf 简介</h1><p><strong>protocolbuffer</strong>(以下简称PB)是google 的一种数据交换的格式，它独立于语言，<a href="https://baike.baidu.com/item/%E7%8B%AC%E7%AB%8B/3259" target="_blank" rel="noopener">独立</a>于平台。google 提供了多种语言的实现：java、<a href="https://baike.baidu.com/item/c%23" target="_blank" rel="noopener">c#</a>、<a href="https://baike.baidu.com/item/c%2B%2B" target="_blank" rel="noopener">c++</a>、go 和 <a href="https://baike.baidu.com/item/python" target="_blank" rel="noopener">python</a>，每一种实现都包含了相应语言的<a href="https://baike.baidu.com/item/%E7%BC%96%E8%AF%91%E5%99%A8" target="_blank" rel="noopener">编译器</a>以及库文件。由于它是一种二进制的格式，比使用 <a href="https://baike.baidu.com/item/xml" target="_blank" rel="noopener">xml</a> 进行数据交换快许多。可以把它用于<a href="https://baike.baidu.com/item/%E5%88%86%E5%B8%83%E5%BC%8F%E5%BA%94%E7%94%A8" target="_blank" rel="noopener">分布式应用</a>之间的数据通信或者异构环境下的数据交换。作为一种效率和兼容性都很优秀的二进制数据传输格式，可以用于诸如网络传输、配置文件、数据存储等诸多领域。</p>
<h1 id="安装-Protobuf-Support-插件"><a href="#安装-Protobuf-Support-插件" class="headerlink" title="安装 Protobuf Support 插件"></a>安装 Protobuf Support 插件</h1><p>依次点击IDEA中的“Preferences”–&gt;”Plugins”–&gt;”Browse repositories”，输入Protobuf 进行查找安装，也可以下载离线安装包，如图所示：</p>
<figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="/blog/img/posts/ideaProtobuf/1.png" alt="" title="">
                </div>
                <div class="image-caption"></div>
            </figure>
<p>IDEA plugins地址：<a href="https://plugins.jetbrains.com/idea" target="_blank" rel="noopener">IDEA plugins</a> </p>
<p>搜索 Protobuf Support 插件，进行下载，下载完成后点击 <em>Install plugin from disk</em> 进行安装，如图所示：</p>
<figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="/blog/img/posts/ideaProtobuf/2.png" alt="" title="">
                </div>
                <div class="image-caption"></div>
            </figure>
<p>安装完后，重启Intellij IDEA，查看.proto文件，会发现已经支持语法高亮显示。</p>
<h1 id="将-proto-文件转成-Java-类"><a href="#将-proto-文件转成-Java-类" class="headerlink" title="将 .proto 文件转成 Java 类"></a>将 .proto 文件转成 Java 类</h1><p>一般的做法是执行protoc命令,依次将.proto文件转成Java类</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">protoc.exe -I=d:/tmp --java_out=d:/tmp d:/tmp/monitor_data.proto</span><br></pre></td></tr></table></figure>
<p>也可以写个批处理文件进行处理，具体如下:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line">@echo off</span><br><span class="line"></span><br><span class="line">set Path=Path;%cd%</span><br><span class="line">set PATH_DEST=H:\server\gamehall\protocol\src\main\java</span><br><span class="line">set PATH_PO1=H:\server\Protocol\ClientProto</span><br><span class="line">set PATH_PO2=H:\server\Protocol\ServerProto</span><br><span class="line"></span><br><span class="line">cd %PATH_PO1%</span><br><span class="line">pushd %PATH_PO1% </span><br><span class="line">for %%a in (*.proto) do (</span><br><span class="line">    echo %%a</span><br><span class="line">    protoc --java_out=%PATH_DEST% -I=. %%a</span><br><span class="line">)</span><br><span class="line"></span><br><span class="line">cd %PATH_PO2%</span><br><span class="line">pushd %PATH_PO2% </span><br><span class="line">for %%a in (*.proto) do (</span><br><span class="line">    echo %%a</span><br><span class="line">    protoc --java_out=%PATH_DEST% -I=. %%a</span><br><span class="line">)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">pause</span><br></pre></td></tr></table></figure>
<p>不过gRPC官方推荐了一种更优雅的使用姿势，可以通过maven轻松搞定</p>
<p>pom.xml 增加依赖</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br></pre></td><td class="code"><pre><span class="line">&lt;properties&gt;</span><br><span class="line">    &lt;protobuf.version&gt;2.5.0&lt;/protobuf.version&gt;</span><br><span class="line">    &lt;grpc.version&gt;1.6.1&lt;/grpc.version&gt;</span><br><span class="line">&lt;/properties&gt;</span><br><span class="line"></span><br><span class="line">&lt;dependencies&gt;</span><br><span class="line">    &lt;dependency&gt;</span><br><span class="line">        &lt;groupId&gt;io.grpc&lt;/groupId&gt;</span><br><span class="line">        &lt;artifactId&gt;grpc-netty&lt;/artifactId&gt;</span><br><span class="line">        &lt;version&gt;$&#123;grpc.version&#125;&lt;/version&gt;</span><br><span class="line">        &lt;scope&gt;provided&lt;/scope&gt;</span><br><span class="line">    &lt;/dependency&gt;</span><br><span class="line">    &lt;dependency&gt;</span><br><span class="line">        &lt;groupId&gt;io.grpc&lt;/groupId&gt;</span><br><span class="line">        &lt;artifactId&gt;grpc-protobuf&lt;/artifactId&gt;</span><br><span class="line">        &lt;version&gt;$&#123;grpc.version&#125;&lt;/version&gt;</span><br><span class="line">        &lt;scope&gt;provided&lt;/scope&gt;</span><br><span class="line">    &lt;/dependency&gt;</span><br><span class="line">    &lt;dependency&gt;</span><br><span class="line">        &lt;groupId&gt;io.grpc&lt;/groupId&gt;</span><br><span class="line">        &lt;artifactId&gt;grpc-stub&lt;/artifactId&gt;</span><br><span class="line">        &lt;version&gt;$&#123;grpc.version&#125;&lt;/version&gt;</span><br><span class="line">        &lt;scope&gt;provided&lt;/scope&gt;</span><br><span class="line">    &lt;/dependency&gt;</span><br><span class="line">    &lt;dependency&gt;</span><br><span class="line">        &lt;groupId&gt;com.google.protobuf&lt;/groupId&gt;</span><br><span class="line">        &lt;artifactId&gt;protobuf-java&lt;/artifactId&gt;</span><br><span class="line">        &lt;version&gt;$&#123;protobuf.version&#125;&lt;/version&gt;</span><br><span class="line">    &lt;/dependency&gt;</span><br><span class="line">&lt;/dependencies&gt;</span><br><span class="line"></span><br><span class="line">&lt;build&gt;</span><br><span class="line">        &lt;extensions&gt;</span><br><span class="line">            &lt;extension&gt;</span><br><span class="line">                &lt;groupId&gt;kr.motd.maven&lt;/groupId&gt;</span><br><span class="line">                &lt;artifactId&gt;os-maven-plugin&lt;/artifactId&gt;</span><br><span class="line">                &lt;version&gt;1.5.0.Final&lt;/version&gt;</span><br><span class="line">            &lt;/extension&gt;</span><br><span class="line">        &lt;/extensions&gt;</span><br><span class="line">        &lt;plugins&gt;</span><br><span class="line">            &lt;plugin&gt;</span><br><span class="line">                &lt;groupId&gt;org.xolstice.maven.plugins&lt;/groupId&gt;</span><br><span class="line">                &lt;artifactId&gt;protobuf-maven-plugin&lt;/artifactId&gt;</span><br><span class="line">                &lt;version&gt;0.5.0&lt;/version&gt;</span><br><span class="line">                &lt;configuration&gt;</span><br><span class="line">                    &lt;protocArtifact&gt;com.google.protobuf:protoc:$&#123;protobuf.version&#125;:exe:$&#123;os.detected.classifier&#125;&lt;/protocArtifact&gt;</span><br><span class="line">                    &lt;pluginId&gt;grpc-java&lt;/pluginId&gt;</span><br><span class="line">                    &lt;pluginArtifact&gt;io.grpc:protoc-gen-grpc-java:$&#123;grpc.version&#125;:exe:$&#123;os.detected.classifier&#125;&lt;/pluginArtifact&gt;</span><br><span class="line">                &lt;/configuration&gt;</span><br><span class="line">                &lt;executions&gt;</span><br><span class="line">                    &lt;execution&gt;</span><br><span class="line">                        &lt;goals&gt;</span><br><span class="line">                            &lt;goal&gt;compile&lt;/goal&gt;</span><br><span class="line">                            &lt;goal&gt;compile-custom&lt;/goal&gt;</span><br><span class="line">                        &lt;/goals&gt;</span><br><span class="line">                    &lt;/execution&gt;</span><br><span class="line">                &lt;/executions&gt;</span><br><span class="line">            &lt;/plugin&gt;</span><br><span class="line">        &lt;/plugins&gt;</span><br><span class="line">    &lt;/build&gt;</span><br></pre></td></tr></table></figure>
<font style="color:red;"><br><br>注意事项：.proto文件需要放置在src/main/proto包下<br><br></font>



<p>最后使用maven进行编译,如图所示:</p>
<p><img src="/blog/img/posts/ideaProtobuf/3.png" alt=""></p>
<p>现在我们就可以愉快的使用protobuf了。</p>

        </div>

        <blockquote class="post-copyright">
    
    <div class="content">
        
<span class="post-time">
    最后更新时间：<time datetime="2018-04-28T15:42:48.000Z" itemprop="dateUpdated">2018-04-28 23:42:48</time>
</span><br>


        
        原文链接：<a href="/blog/2018/03/12/IDEA使用protobuf的正确姿势.html" target="_blank" rel="external">http://aixiaodenanhai.gitee.io/blog/2018/03/12/IDEA使用protobuf的正确姿势.html</a>
        
    </div>
    
    <footer>
        <a href="http://aixiaodenanhai.gitee.io/blog">
            <img src="/blog/img/avatar.jpg" alt="何俊鑫">
            何俊鑫
        </a>
    </footer>
</blockquote>

        
<div class="page-reward">
    <a id="rewardBtn" href="javascript:;" class="page-reward-btn waves-effect waves-circle waves-light">赏</a>
</div>



        <div class="post-footer">
            
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/blog/tags/IDEA/">IDEA</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/blog/tags/protobuf/">protobuf</a></li></ul>


            
<div class="page-share-wrap">
    

<div class="page-share" id="pageShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://aixiaodenanhai.gitee.io/blog/2018/03/12/IDEA使用protobuf的正确姿势.html&title=《IDEA中使用Protobuf的正确姿势》 — Junxin's Blog&pic=http://aixiaodenanhai.gitee.io/blog/img/avatar.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://aixiaodenanhai.gitee.io/blog/2018/03/12/IDEA使用protobuf的正确姿势.html&title=《IDEA中使用Protobuf的正确姿势》 — Junxin's Blog&source=" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://aixiaodenanhai.gitee.io/blog/2018/03/12/IDEA使用protobuf的正确姿势.html" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《IDEA中使用Protobuf的正确姿势》 — Junxin's Blog&url=http://aixiaodenanhai.gitee.io/blog/2018/03/12/IDEA使用protobuf的正确姿势.html&via=http://aixiaodenanhai.gitee.io/blog" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://aixiaodenanhai.gitee.io/blog/2018/03/12/IDEA使用protobuf的正确姿势.html" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>



    <a href="javascript:;" id="shareFab" class="page-share-fab waves-effect waves-circle">
        <i class="icon icon-share-alt icon-lg"></i>
    </a>
</div>



        </div>
    </div>

    
<nav class="post-nav flex-row flex-justify-between">
  
    <div class="waves-block waves-effect prev">
      <a href="/blog/2018/04/10/IDEA将已有项目添加到git.html" id="post-prev" class="post-nav-link">
        <div class="tips"><i class="icon icon-angle-left icon-lg icon-pr"></i> Prev</div>
        <h4 class="title">IDEA将已有项目添加到git</h4>
      </a>
    </div>
  

  
</nav>



    

















</article>

<div id="reward" class="page-modal reward-lay">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <h3 class="reward-title">
        <i class="icon icon-quote-left"></i>
        谢谢打赏.
        <i class="icon icon-quote-right"></i>
    </h3>
    <div class="reward-content">
        
        <div class="reward-code">
            <img id="rewardCode" src="/blog/img/wechat.png" alt="打赏二维码">
        </div>
        
        <label class="reward-toggle">
            <input id="rewardToggle" type="checkbox" class="reward-toggle-check"
                data-wechat="/blog/img/wechat.png" data-alipay="/blog/img/alipay.png">
            <div class="reward-toggle-ctrol">
                <span class="reward-toggle-item wechat">微信</span>
                <span class="reward-toggle-label"></span>
                <span class="reward-toggle-item alipay">支付宝</span>
            </div>
        </label>
        
    </div>
</div>



</div>

        <footer class="footer">
    <div class="top">
        
<p>
    <span id="busuanzi_container_site_uv" style='display:none'>
        站点总访客数：<span id="busuanzi_value_site_uv"></span>
    </span>
    <span id="busuanzi_container_site_pv" style='display:none'>
        站点总访问量：<span id="busuanzi_value_site_pv"></span>
    </span>
</p>


        <p>
            
                <span><a href="/blog/atom.xml" target="_blank" class="rss" title="rss"><i class="icon icon-lg icon-rss"></i></a></span>
            
            <span>博客内容遵循 <a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">知识共享 署名 - 非商业性 - 相同方式共享 4.0 国际协议</a></span>
        </p>
    </div>
    <div class="bottom">
        <p><span>何俊鑫 &copy; 2015 - 2018</span>
            <span>
                
                Power by <a href="http://hexo.io/" target="_blank">Hexo</a> Theme <a href="https://github.com/yscoder/hexo-theme-indigo" target="_blank">indigo</a>
            </span>
        </p>
    </div>
</footer>

    </main>
    <div class="mask" id="mask"></div>
<a href="javascript:;" id="gotop" class="waves-effect waves-circle waves-light"><span class="icon icon-lg icon-chevron-up"></span></a>



<div class="global-share" id="globalShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://aixiaodenanhai.gitee.io/blog/2018/03/12/IDEA使用protobuf的正确姿势.html&title=《IDEA中使用Protobuf的正确姿势》 — Junxin's Blog&pic=http://aixiaodenanhai.gitee.io/blog/img/avatar.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://aixiaodenanhai.gitee.io/blog/2018/03/12/IDEA使用protobuf的正确姿势.html&title=《IDEA中使用Protobuf的正确姿势》 — Junxin's Blog&source=" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://aixiaodenanhai.gitee.io/blog/2018/03/12/IDEA使用protobuf的正确姿势.html" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《IDEA中使用Protobuf的正确姿势》 — Junxin's Blog&url=http://aixiaodenanhai.gitee.io/blog/2018/03/12/IDEA使用protobuf的正确姿势.html&via=http://aixiaodenanhai.gitee.io/blog" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://aixiaodenanhai.gitee.io/blog/2018/03/12/IDEA使用protobuf的正确姿势.html" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>


<div class="page-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <p>扫一扫，分享到微信</p>
    <img src="" alt="微信分享二维码">
</div>




    <script src="//cdn.bootcss.com/node-waves/0.7.4/waves.min.js"></script>
<script>
var BLOG = { ROOT: '/blog/', SHARE: true, REWARD: true };


</script>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/main.min.js"></script>


<div class="search-panel" id="search-panel">
    <ul class="search-result" id="search-result"></ul>
</div>
<template id="search-tpl">
<li class="item">
    <a href="{path}" class="waves-block waves-effect">
        <div class="title ellipsis" title="{title}">{title}</div>
        <div class="flex-row flex-middle">
            <div class="tags ellipsis">
                {tags}
            </div>
            <time class="flex-col time">{date}</time>
        </div>
    </a>
</li>
</template>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/search.min.js" async></script>






<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>



<script>
(function() {
    var OriginTitile = document.title, titleTime;
    document.addEventListener('visibilitychange', function() {
        if (document.hidden) {
            document.title = '死鬼去哪里了！';
            clearTimeout(titleTime);
        } else {
            document.title = '(つェ⊂)咦!又好了!';
            titleTime = setTimeout(function() {
                document.title = OriginTitile;
            },2000);
        }
    });
})();
</script>



</body>
</html>
